package com.westos.echufang.utils;


import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;

@Component
public class MultipartFileUtil {

    public boolean toFile(File file, byte[] multipartFile) throws IOException{
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
            bufferedOutputStream.write(multipartFile);
            fileOutputStream.close();
            bufferedOutputStream.close();
            return file.exists();
        }
    }

